package javaEEBasic.day05;

import java.util.List;
import java.util.Objects;

public class Student {
    private String name;
    private int yuwen;
    private int shuxue;
    private List<String> likes;

    public Student(String name, int yuwen, int shuxue, List<String> likes) {
        this.name = name;
        this.yuwen = yuwen;
        this.shuxue = shuxue;
        this.likes = likes;
    }
    public void show() {
        System.out.println("姓名" + this.name + "，语文成绩：" + this.yuwen + "，数学成绩：" + this.shuxue);
        this.likes.forEach(System.out::println);
    }

    @Override
    public boolean equals(Object object) {
        if (this == object) return true;
        if (object == null || getClass() != object.getClass()) return false;
        Student student = (Student) object;
        return Objects.equals(name, student.name) && Objects.equals(likes, student.likes);
    }

    @Override
    public int hashCode() {
        return Objects.hash(name, likes);
    }

    @Override
    protected Object clone() throws CloneNotSupportedException {
        return super.clone();
    }
}
